#
#
CLEANFILES = *~
DISTCLEANFILES = *~

noinst_PROGRAMS = runtest socktest cbperf \
	drivers/ecmsock_test drivers/thread_test \
	drivers/process_test drivers/pathmon_test drivers/edbdfile_test

noinst_LTLIBRARIES = test.la
noinst_DATA = clx/rc/snapshot.init

runtest_SOURCES = runtest.c runtest_build_clxhome.c

socktest_SOURCES = socktest.c
cbperf_SOURCES = cbperf.c

drivers_ecmsock_test_SOURCES = ecmsock_test.c
drivers_thread_test_SOURCES = thread_test.c
drivers_process_test_SOURCES = process_test.c
drivers_pathmon_test_SOURCES = pathmon_test.c
drivers_edbdfile_test_SOURCES = edbdfile_test.c

test_la_SOURCES = test.c
test_la_LDFLAGS = -rpath /usr/lib -module -shared -avoid-version

INCLUDES = -I ../lib/libbase -I ../lib/libsr -I ../lib/libebc -I ../src/edbd

EBCCLIENT_LDADD = ../lib/libebc/libebc.la ../lib/libsr/libsr.la ../lib/libbase/libbase.la -lm @LINK_DL@ -lpthread
EDBCLIENT_LDADD = ../lib/libedb/libedb.la $(EBCCLIENT_LDADD)

runtest_LDADD = $(EDBCLIENT_LDADD)
socktest_LDADD = $(EBCCLIENT_LDADD)
cbperf_LDADD = $(EBCCLIENT_LDADD)

drivers_ecmsock_test_LDADD = $(EBCCLIENT_LDADD)
drivers_thread_test_LDADD = $(EBCCLIENT_LDADD)
drivers_process_test_LDADD = $(EBCCLIENT_LDADD)
drivers_pathmon_test_LDADD = $(EDBCLIENT_LDADD)
drivers_edbdfile_test_LDADD = $(EDBCLIENT_LDADD)

MKENTITY = ../src/mkentity/mkentity

test.sobj: test.spec
	$(MKENTITY) -c $<

clx/rc/snapshot.init: test.sobj
	$(MKENTITY) -B $< .libs/test.so
	mkdir -p clx/etc
	mkdir -p clx/ecx
	mkdir -p clx/rc >& /dev/null
	mkdir -p clx/modules >& /dev/null
	mkdir -p clx/log >& /dev/null
	mkdir -p clx/etc >& /dev/null
	cp -f license.key clx/etc/
	cp -f econf clx/etc/
	cp snapshot.init clx/rc/
	cp test.smod clx/modules/
	cp .libs/test.so clx/modules/

